using Microsoft.AspNetCore.Mvc;
using SqlSugar;

namespace Framework.SqlSugar.Test.Controllers
{
	[ApiController]
	[Route("[controller]")]
	public class WeatherForecastController : ControllerBase
	{
		private static readonly string[] Summaries = new[]
		{
			"Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
		};

		private readonly ISqlSugarClient _db;
		private readonly ILogger<WeatherForecastController> _logger;

		public WeatherForecastController(ISqlSugarClient db, ILogger<WeatherForecastController> logger)
		{
			_db = db;
			_logger = logger;
		}

		[HttpGet]
		public List<Test> Get()
		{
			_db.DbFirst.Where("Test").CreateClassFile("c:\\Demo\\2", "Entity");
			return _db.Queryable<Test>().ToList();
			//return Enumerable.Range(1, 5).Select(index => new WeatherForecast
			//{
			//	Date = DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
			//	TemperatureC = Random.Shared.Next(-20, 55),
			//	Summary = Summaries[Random.Shared.Next(Summaries.Length)]
			//})
			//.ToArray();
		}
	}
}
